package com.example.mapper;

import com.example.entity.Script;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.github.pagehelper.Page;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.ArrayList;
import java.util.List;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author 陈昌吉
 * @since 2024-04-16
 */
@Mapper
public interface ScriptMapper extends BaseMapper<Script> {


    @Delete("delete from script where sid=#{sid} and login_id=#{loginId}")
    void deleteScriptUrl(Script script);

    /**
     * 根据学生id去获取上传的Script作业
     *
     * @param currentId
     * @param hid
     * @return
     */
    @Select("select * from script where login_id=#{currentId} and hid=#{hid}")
    List<Script> sllectScript(Integer currentId, Integer hid);


    @Select("select * from script where login_id=#{loginId} and hid=#{hid}")
    List<Script> sllectScripts(Script a);


    List<Script> getState(Integer currentId, ArrayList<Integer> hids);

    /**
     * 审核员处获取所有的作业
     * @param script
     * @return
     */
    Page<Script> seleectgetScrip(Script script);

    /**
     * 审核对提交的作业进行审核
     * @param script
     * @return
     */
    Integer updateState(Script script);

}
